export default {
    state: {
        token: null || sessionStorage.getItem("token"),
        user: null || JSON.parse(sessionStorage.getItem("user")),
    },
    mutations: {
        setToken(state, token) {
            state.token = token
            token == null ? sessionStorage.removeItem("token")
                : sessionStorage.setItem("token", token)
        },
        setUser(state, val) {
            state.user = val
            let user = JSON.stringify(state.user)
            sessionStorage.setItem("user", user)
        },
    },
    actions: {
    }

}
